setwd("C:/Users/86139/Desktop/ADdata/")
library(openxlsx)
a <- read.table("ADdata1.txt")
b <- read.csv('ADdata2.csv')
c <- read.xlsx("ADdata3.xlsx")
d <- read.table("ADdata4.txt")

colnames(b)[1] <- "ProteinID"
colnames(c)[1] <- "ProteinID"
merged_data1 <- merge(a, d, by.x=0, by.y=0, all=TRUE) 
colnames(merged_data1)[1] <- "ProteinID"
merged_data2 <- merge(b, c, by="ProteinID", all=TRUE)
merged_data <- merge(merged_data1,merged_data2,by="ProteinID")

write.csv(merged_data, "merged_data.csv")
write.xlsx(merged_data, "merged_data.xlsx")
write.table(merged_data, "merged_data.txt", sep = "\t", quote = FALSE)